#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <time.h>

int main ()
{
    
    time_t last_check_time = time(NULL);

    time_t now;
    time_t last_modify_time;
    struct stat st_buf;
    stat ("test.ini", &st_buf);
    printf ("creat time = %lu size = %lu\n", st_buf.st_ctime, st_buf.st_size);
    last_modify_time = st_buf.st_mtime;
    while (1)
    {
	sleep(2);
	stat ("test.ini", &st_buf);
	if (st_buf.st_mtime != last_modify_time)
	{
	    last_modify_time = st_buf.st_mtime;
	    printf ("test.ini is modified, creat time = %lu\n",
		    st_buf.st_atime);
	}
    }
}
